package sg.edu.nus.iss.team4ft.service;

import java.io.IOException;
import java.util.Map;

import sg.edu.nus.iss.team4ft.util.AccountIOService;

public class RateTable {
	
	public Double getSubscriptionCharge(PlanCode plancode, FeatureCode featureCode) throws IOException {
		Map<String,String> subscription = AccountIOService.subscriptionMap();
		String key = plancode + " " + featureCode;
		if(subscription.get(key)==null)
			return 0.0;
		else
			return Double.parseDouble(subscription.get(key));
	}	
	public Double getChargePerUnit(PlanCode plancode, FeatureCode featureCode) throws IOException {
		Map<String,String> usageCharge = AccountIOService.usageChargeMap();
		String key = plancode + " " + featureCode;
		if(usageCharge.get(key)==null)
			return 0.0;
		else			
			return Double.parseDouble(usageCharge.get(key));
	}
}
